<include file="Public/inc/header.html" />
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">药品管理</h3>
                        <h3 class="box-title"><span><a href="/drm/index.php/Home/Drugs/Index/">返回操作</a></span></h3>
                    </div><!-- /.box-header -->
                    <!-- form start -->
                    <form class="form-horizontal" method="POST" action="/drm/index.php/Home/Drugs/Index/{$type}.html">
                        <input type='hidden' name='id' value="{$data.id}">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="name" class="col-sm-2 control-label">商品名称</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name='name' id="name" placeholder="请输入药品名称" value="{$data.name}" required >
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="company" class="col-sm-2 control-label">生产厂家</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name='company' id="company" placeholder="请输入生产厂家" value="{$data.company}" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="rest_num" class="col-sm-2 control-label">剩余数量</label>
                                <div class="col-sm-10">
                                    <input type="number" class="form-control" min='0' name='rest_num' id="rest_num" placeholder="请输入剩余数量" value="{$data.rest_num}" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="crash_id" class="col-sm-2 control-label">冲突药品ID</label>
                                <div class="col-sm-10">
                                    <input type="number" class="form-control" name='crash_id' min='0' id="crash_id" value="{$data.crash_id}" placeholder="请输入冲突药品ID">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="period" class="col-sm-2 control-label">过期时间</label>
                                <div class="col-sm-10">
                                    <input type="date" class="form-control" name='period' id="period" placeholder="请输入过期时间" value="{$data['period']|default=time()|date='Y-m-d',###}" required>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="depot_id" class="col-sm-2 control-label">药品所在仓库</label>
                                <div class='col-sm-10'>
                                    <select class='form-control select2' name='depot_id'>
                                        <foreach name='depots' item='vo'>
                                            <option <if condition="$vo['id'] == $data['depot_id']"> selected=selected </if> value="{$vo['id']}">{$vo['name']}</option>
                                        </foreach>
                                    </select>
                                </div>
                            </div>
                        </div><!-- /.box-body -->

                        <div class="box-footer">
                            <button type="reset" class="btn btn-alert pull-left">清空</button>
                            <button type="submit" class="btn btn-info pull-right"><if condition="$type=='drugAdd'">添加<else />修改</if></button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <include file="Public/inc/footer.html" />
